<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActiveSupport::SafeBuffer</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActiveSupport::SafeBuffer 
            
                <span class="parent">&lt; 
                    
                    <a href="../String.html">String</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/activesupport/lib/active_support/core_ext/string/output_safety_rb.html">activesupport/lib/active_support/core_ext/string/output_safety.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  
    <!-- Namespace -->
    <div class="sectiontitle">Namespace</div>
    <ul>
      
        <li>
          <span class="type">CLASS</span>
          <a href="SafeBuffer/SafeConcatError.html">ActiveSupport::SafeBuffer::SafeConcatError</a>
        </li>
      
    </ul>
  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-25">%</a>,
              </li>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-2B">+</a>,
              </li>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-3C-3C">&lt;&lt;</a>,
              </li>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-5B-5D">[]</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-clone_empty">clone_empty</a>,
              </li>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-concat">concat</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-encode_with">encode_with</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>H</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-html_safe-3F">html_safe?</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-initialize_copy">initialize_copy</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>N</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-c-new">new</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>O</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-original_concat">original_concat</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-safe_concat">safe_concat</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-to_param">to_param</a>,
              </li>
            
              
              <li>
                <a href="SafeBuffer.html#method-i-to_s">to_s</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">UNSAFE_STRING_METHODS</td>
            <td>=</td>
            <td class="attr-value">%w(
capitalize chomp chop delete downcase gsub lstrip next reverse rstrip
slice squeeze strip sub succ swapcase tr tr_s upcase prepend
)</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-new">
            
              <b>new</b>(*)
            
            <a href="SafeBuffer.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L118" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 118</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(*)
  <span class="ruby-ivar">@html_safe</span> = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">super</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-25">
            
              <b>%</b>(args)
            
            <a href="SafeBuffer.html#method-i-25" name="method-i-25" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-25_source')" id="l_method-i-25_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L145" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-25_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 145</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">%</span>(<span class="ruby-keyword ruby-title">args</span>)
  <span class="ruby-identifier">args</span> = <span class="ruby-constant">Array</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">html_safe?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">html_safe?</span>
      <span class="ruby-identifier">arg</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-constant">ERB</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">h</span>(<span class="ruby-identifier">arg</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>

  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">super</span>(<span class="ruby-identifier">args</span>))
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-2B">
            
              <b>+</b>(other)
            
            <a href="SafeBuffer.html#method-i-2B" name="method-i-2B" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-2B_source')" id="l_method-i-2B_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L141" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-2B_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 141</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">+</span>(<span class="ruby-keyword ruby-title">other</span>)
  <span class="ruby-identifier">dup</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">other</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-3C-3C">
            
              <b>&lt;&lt;</b>(value)
            
            <a href="SafeBuffer.html#method-i-3C-3C" name="method-i-3C-3C" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-5B-5D">
            
              <b>[]</b>(*args)
            
            <a href="SafeBuffer.html#method-i-5B-5D" name="method-i-5B-5D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-5B-5D_source')" id="l_method-i-5B-5D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L99" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-5B-5D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 99</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(*<span class="ruby-keyword ruby-title">args</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-number">2</span>
    <span class="ruby-keyword">super</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">html_safe?</span>
      <span class="ruby-identifier">new_safe_buffer</span> = <span class="ruby-keyword">super</span>
      <span class="ruby-identifier">new_safe_buffer</span>.<span class="ruby-identifier">instance_eval</span> { <span class="ruby-ivar">@html_safe</span> = <span class="ruby-keyword">true</span> }
      <span class="ruby-identifier">new_safe_buffer</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">to_str</span>[*<span class="ruby-identifier">args</span>]
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-clone_empty">
            
              <b>clone_empty</b>()
            
            <a href="SafeBuffer.html#method-i-clone_empty" name="method-i-clone_empty" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-clone_empty_source')" id="l_method-i-clone_empty_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L128" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-clone_empty_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 128</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">clone_empty</span>
  <span class="ruby-keyword">self</span>[<span class="ruby-number">0</span>, <span class="ruby-number">0</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-concat">
            
              <b>concat</b>(value)
            
            <a href="SafeBuffer.html#method-i-concat" name="method-i-concat" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="SafeBuffer.html#method-i-original_concat">original_concat</a>, <a href="SafeBuffer.html#method-i-3C-3C">&lt;&lt;</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-concat_source')" id="l_method-i-concat_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L132" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-concat_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 132</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">concat</span>(<span class="ruby-identifier">value</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">html_safe?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">html_safe?</span>
    <span class="ruby-keyword">super</span>(<span class="ruby-identifier">value</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">super</span>(<span class="ruby-constant">ERB</span><span class="ruby-operator">::</span><span class="ruby-constant">Util</span>.<span class="ruby-identifier">h</span>(<span class="ruby-identifier">value</span>))
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-encode_with">
            
              <b>encode_with</b>(coder)
            
            <a href="SafeBuffer.html#method-i-encode_with" name="method-i-encode_with" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-encode_with_source')" id="l_method-i-encode_with_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L169" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-encode_with_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 169</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">encode_with</span>(<span class="ruby-identifier">coder</span>)
  <span class="ruby-identifier">coder</span>.<span class="ruby-identifier">represent_scalar</span> <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">to_str</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-html_safe-3F">
            
              <b>html_safe?</b>()
            
            <a href="SafeBuffer.html#method-i-html_safe-3F" name="method-i-html_safe-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-html_safe-3F_source')" id="l_method-i-html_safe-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L157" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-html_safe-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 157</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">html_safe?</span>
  <span class="ruby-keyword">defined?</span>(<span class="ruby-ivar">@html_safe</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@html_safe</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-initialize_copy">
            
              <b>initialize_copy</b>(other)
            
            <a href="SafeBuffer.html#method-i-initialize_copy" name="method-i-initialize_copy" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-initialize_copy_source')" id="l_method-i-initialize_copy_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L123" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-initialize_copy_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 123</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize_copy</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-keyword">super</span>
  <span class="ruby-ivar">@html_safe</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">html_safe?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-original_concat">
            
              <b>original_concat</b>(value)
            
            <a href="SafeBuffer.html#method-i-original_concat" name="method-i-original_concat" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-safe_concat">
            
              <b>safe_concat</b>(value)
            
            <a href="SafeBuffer.html#method-i-safe_concat" name="method-i-safe_concat" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-safe_concat_source')" id="l_method-i-safe_concat_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L113" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-safe_concat_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 113</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">safe_concat</span>(<span class="ruby-identifier">value</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">SafeConcatError</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">html_safe?</span>
  <span class="ruby-identifier">original_concat</span>(<span class="ruby-identifier">value</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_param">
            
              <b>to_param</b>()
            
            <a href="SafeBuffer.html#method-i-to_param" name="method-i-to_param" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_param_source')" id="l_method-i-to_param_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L165" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_param_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 165</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_param</span>
  <span class="ruby-identifier">to_str</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_s">
            
              <b>to_s</b>()
            
            <a href="SafeBuffer.html#method-i-to_s" name="method-i-to_s" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_s_source')" id="l_method-i-to_s_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/cc986db54665c4155f1b8da5d3f2ebf4a55ef23f/activesupport/lib/active_support/core_ext/string/output_safety.rb#L161" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_s_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 161</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_s</span>
  <span class="ruby-keyword">self</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    